<?php
class User extends AppModel{
	var $name = "User";
	public $validate = array(
								"username" => array(
													"rule1" => array(
																	"rule" => "notEmpty",
																	"message" => "Username can not empty",
																	),
													),
								"gender" => array(
													"rule" => "notEmpty",
													"message" => "Please choise your gender",
												),
								"pass" => array(
													"rule" => "notEmpty",
													"message" => "Password can not empty",
													"on" => "create"
												),
								"re-pass" => array(
														"rule1" => array(
																			"rule" => "notEmpty",
																			"message" => "Password cofirm can not empty",
																			"on" => "create"
																		),
													),
								"level" => array(
													"rule" => "notEmpty",
													"message" => "Please select level",
												),
								"email" => array(
													"rule" => "email",
													"message" => "Email is not avalible",
												),
							);
	public function beforeSave($options = array()){
		if(isset($this -> data[$this -> alias]['password'])){
			$this -> data[$this -> alias]['password'] = AuthComponent::password($this -> data[$this -> alias]['password']);
		}
			return true;
	}
}